package o;

import android.app.Activity;
import android.content.Context;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.appgallery.foundation.card.base.bean.BaseDistCardBean;
import com.huawei.appgallery.foundation.ui.framework.widget.button.DownloadButton;
import com.huawei.appmarket.service.appdetail.view.widget.DetailDownloadButton;
import com.huawei.fastengine.fastview.startFastappEngine.bean.RpkInfo;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.huawei.hwid.core.constants.HwAccountConstants;
import java.util.LinkedHashMap;
import o.dge.d;
import o.ewm.n;

public class djx {
    private static String ˏ = "DownloadBtnReportManager";

    protected static void ˏ(BaseDistCardBean baseDistCardBean, Context context) {
        Logger.ˏ(ˏ, "Open App:" + baseDistCardBean.v_());
        cgo.ˋ(HwAccountConstants.TYPE_TENCENT, baseDistCardBean.ॱॱ(), dgm.ˎ((Activity) context));
    }

    protected static void ˋ(BaseDistCardBean baseDistCardBean, cke o_cke, Context context) {
        if (baseDistCardBean == null) {
            Logger.e(ˏ, "reportButtonClickEvent: cardBean == null");
            return;
        }
        int i;
        switch (o_cke) {
            case SMART_UPGRADE_APP:
            case UPGRADE_APP:
                i = 6;
                break;
            case DOWNLOAD_APP:
            case PRE_DOWNLAD_APP:
            case INSTALL_APP:
                i = 1;
                break;
            case RESERVE_DOWNLOAD_APP:
            case UNRESERVED_GAME:
                i = 2;
                break;
            case RESERVED_GAME:
                i = 5;
                break;
            case PAUSE_DOWNLOAD_APP:
                i = 8;
                break;
            case RESUME_DONWLOAD_APP:
                i = 9;
                break;
            default:
                Logger.ˏ(ˏ, "reportButtonClickEvent:  the button status=" + o_cke);
                i = 0;
                break;
        }
        if (cke.DEPEND_GMS_APP == o_cke && baseDistCardBean.ˈ()) {
            LinkedHashMap linkedHashMap = new LinkedHashMap();
            linkedHashMap.put("pkgName", baseDistCardBean.ॱـ());
            linkedHashMap.put("url", baseDistCardBean.ʼ());
            dgh.ˋ("390101", linkedHashMap);
            return;
        }
        if (baseDistCardBean.ᐝॱ() && !ebz.ॱ().ˎ(baseDistCardBean.ॱـ())) {
            i = 3;
        }
        LinkedHashMap linkedHashMap2 = new LinkedHashMap();
        linkedHashMap2.put(RpkInfo.APPID, baseDistCardBean.ͺˏ());
        linkedHashMap2.put("type", String.valueOf(i));
        linkedHashMap2.put("service_type", String.valueOf(dgm.ˎ((Activity) context)));
        linkedHashMap2.put("detailid", baseDistCardBean.ॱॱ());
        dgh.ˋ("card_installbtn_click", linkedHashMap2);
    }

    public static void ˊ(String str, Context context) {
        cgo.ˋ("5", str, dgm.ˎ((Activity) context));
    }

    protected static void ˎ(Context context, String str) {
        cgo.ˋ(HwAccountConstants.TYPE_SINA, str, dgm.ˎ((Activity) context));
    }

    protected static void ˎ(Context context, String str, DownloadButton downloadButton) {
        int i;
        if (downloadButton instanceof DetailDownloadButton) {
            i = n.ʼᐝ;
        } else {
            i = n.ʽˋ;
        }
        dgh.onEvent(new d(context, i).ˏ(str + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + UserSession.getInstance().getUserId()).ˋ());
    }

    protected static void ˎ(Context context, String str, String str2) {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        linkedHashMap.put("appName", str);
        linkedHashMap.put("detailid", str2);
        dgh.ˋ(context.getString(n.ˊʽ), linkedHashMap);
    }

    protected static void ॱ(Context context, String str, String str2) {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        linkedHashMap.put("appName", str);
        linkedHashMap.put("detailid", str2);
        dgh.ˋ(context.getString(n.ˌॱ), linkedHashMap);
    }
}
